<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div {
            width: 500px;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div id="box">
    <hr width="100%" align="center">

</div>
<script>
    var i = 100;
    var s = '';
    while (i>0){
        s = s + '<hr width="'+i+'%" align="center">';
        i = i - 2;  //步长
    }
    var box = document.getElementById('box');
    box.innerHTML = s;
</script>
</body>
</html>